//
//  YBMineUserGroupPopupView.swift
//  Moonlight
//
//  Created by Penlon Kim on 2023/7/1.
//  Copyright © 2023 Moonlight Game Streaming Project. All rights reserved.
//

import UIKit
import SnapKit

class YBMineUserGroupPopupView: UIView {
    
    override init(frame: CGRect) {
        super.init(frame: frame)
        
        let desLabel = self.bk_addLabel(text: "扫一扫二维码，加入群聊", font: .systemFont(ofSize: 14, weight: .medium), bgColor: .clear, textColor: ColorDef.gray153, align: .center)
        
        self.addSubview(bgView)
        bgView.addSubviews([titleLabel, numberLabel, qrCodeImgView, desLabel])
        
        bgView.snp.makeConstraints { (make) in
            make.edges.equalToSuperview()
            make.width.equalTo(kScreenWidth*0.8)
        }
        
        titleLabel.snp.makeConstraints { make in
            make.centerX.equalToSuperview()
            make.top.equalTo(offset50)
            make.height.equalTo(25)
        }
        
        numberLabel.snp.makeConstraints { make in
            make.centerX.equalToSuperview()
            make.height.equalTo(16)
            make.top.equalTo(titleLabel.snp.bottom).offset(8)
        }
        
        qrCodeImgView.snp.makeConstraints { make in
            make.centerX.equalToSuperview()
            make.top.equalTo(numberLabel.snp.bottom).offset(20)
            make.size.equalTo(kScreenWidth*0.66)
        }
        
        desLabel.snp.makeConstraints { make in
            make.centerX.equalToSuperview()
            make.height.equalTo(16)
            make.top.equalTo(qrCodeImgView.snp.bottom).offset(15)
            make.bottom.equalTo(-15)
        }
        
    }
    
    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    // MARK: - lazy
    private lazy var bgView: UIView = {
        let view = UIView(color: .lightWhiteDark27)
        return view
    }()
    
    private lazy var titleLabel: UILabel = {
        let label = self.bk_addLabel(text: "酷卡云电脑", font: .systemFont(ofSize: 18, weight: .medium), bgColor: .clear, textColor: .lightBlack51DarkLight230, align: .center)
        label.bk_setTruncatingTail()
        return label
    }()
    
    private lazy var numberLabel = self.bk_addLabel(text: "群号：629729341", font: .systemFont(ofSize: 14), bgColor: .clear, textColor: ColorDef.gray153, align: .center)

    private lazy var qrCodeImgView: UIImageView = {
        let iv = UIImageView()
        iv.image = UIImage(named: "icon_code")
        return iv
    }()
    
}
